<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      /* 当只有一行时，行高设置和高度相等，line-height可以实现垂直居中的效果 */
      p {
        line-height: 100px;
        text-align: center;
        background-color: pink;
        height: 100px;
      }
      /* 行内元素：line-height设置垂直居中 
      text-align水平居中
      */
      .box {
        background-color: aqua;
        height: 100px;
        line-height: 100px;
        text-align: center;
      }

      .box2 {
        height: 100px;
        background-color: yellow;
        /* df */
        display: flex;
        /* jcc 主轴居中*/
        justify-content: center;
        /* aic 交叉轴居中*/
        align-items: center;
      }
    </style>
  </head>
  <body>
    <p>sbfh8ewgqbc auchdw bsqnsdiahcgysdbadnsmbfayuewqbfjfdsamnjahfueqo</p>
    <div class="box">
      <span>张三</span>
      <span>张三</span>
      <span>张三</span>
    </div>
    <div class="box2">
      <span>张三</span>
      <span>张三</span>
      <span>张三</span>
    </div>
  </body>
</html>
